﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace CS322_V4
{
    public partial class OpenImageForm : Form
    {
        public OpenImageForm()
        {
            InitializeComponent();
        }

        private void button1_Click(object sender, EventArgs e)
        {
            OpenFileDialog dlg = new OpenFileDialog();
            dlg.Filter = "BMP files (*.bmp)|*.BMP|" + "All files (*.*)|*.*";
            dlg.CheckFileExists = true;
            dlg.InitialDirectory = Application.StartupPath;
            if (dlg.ShowDialog() == DialogResult.OK)
            {

                Image b = Bitmap.FromFile(dlg.FileName);

                // Prikazuje bitmap-u u picture box-u.
                pictureBox1.BackgroundImage = b;
                pictureBox1.Size = b.Size;

            }
        }
    }
}
